{
  "name": "Case 10 – Internal CapEx Proposal Approval",
  "nodes": [
    {
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2,
      "position": [0, 0],
      "parameters": {
        "formTitle": "Internal CapEx Proposal Submission",
        "formDescription": "Upload CapEx proposal for management approval",
        "formFields": {
          "values": [
            { "fieldLabel": "Department Name", "requiredField": true },
            { "fieldLabel": "Proposal Owner", "requiredField": true },
            { "fieldLabel": "Email id", "fieldType": "email", "requiredField": true },
            {
              "fieldLabel": "CapEx_Proposal",
              "fieldType": "file",
              "acceptFileTypes": ".pdf",
              "requiredField": true
            }
          ]
        }
      }
    },
    {
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [220, 0],
      "parameters": {
        "inputDataFieldName": "CapEx_Proposal",
        "name": "={{ $json['Department Name'] + '_CapEx_Proposal' }}",
        "folderId": "REPLACE_WITH_CAPEX_FOLDER_ID"
      }
    },
    {
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [420, 0],
      "parameters": {
        "operation": "download",
        "fileId": "={{ $json.id }}"
      }
    },
    {
      "name": "Extract Proposal",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [620, 0],
      "parameters": {
        "operation": "pdf"
      }
    },
    {
      "name": "Download Capital Allocation Framework",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [820, 0],
      "parameters": {
        "operation": "download",
        "fileId": "REPLACE_WITH_CAPITAL_FRAMEWORK_FILE_ID"
      }
    },
    {
      "name": "Extract Capital Framework",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [1020, 0],
      "parameters": {
        "operation": "pdf"
      }
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [220, 260],
      "parameters": {
        "promptType": "define",
        "text": "=CapEx Proposal:\n{{ $('Extract Proposal').item.json.text }}\n\nCapital Allocation Framework:\n{{ $('Extract Capital Framework').item.json.text }}",
        "options": {
          "systemMessage": "You are a Corporate Strategy & Finance Committee Member.\n\nYOUR OBJECTIVE:\nAllocate capital efficiently by approving CapEx proposals that deliver strong risk-adjusted returns and align with long-term strategic priorities.\n\nANALYSIS FRAMEWORK (MANDATORY):\n1. STRATEGIC ALIGNMENT – consistency with corporate strategy, growth priorities, and capability building.\n2. FINANCIAL RETURNS – ROI, payback period, cash flow impact, and capital efficiency.\n3. RISK ASSESSMENT – execution risk, demand uncertainty, technology or vendor risk.\n4. CAPITAL INTENSITY – scale of investment relative to expected benefit.\n5. ALTERNATIVE USE OF CAPITAL – opportunity cost versus competing initiatives.\n\nYOU MUST PRODUCE ONE JSON OBJECT WITH EXACTLY THESE FIELDS. ALL FIELDS ARE MANDATORY.\n\nJSON SCHEMA (STRICT):\n{\n  \"Proposal_ID\": \"string\",\n  \"Department_Name\": \"string\",\n  \"Proposal_Category\": \"Growth | Efficiency | Compliance | Replacement\",\n  \"Total_CapEx_Amount_INR_Cr\": \"number\",\n  \"Expected_Annual_Benefit_INR_Cr\": \"number\",\n  \"Estimated_ROI_Percentage\": \"number\",\n  \"Payback_Period_Years\": \"number\",\n  \"Strategic_Alignment\": \"Low | Medium | High\",\n  \"Execution_Risk\": \"Low | Medium | High\",\n  \"Capital_Priority_Score_out_of_100\": \"number\",\n  \"Committee_Decision\": \"Approved | Needs Revision\",\n  \"Key_Committee_Remarks\": \"string\"\n}\n\nINSTRUCTIONS:\n- Numeric fields MUST contain numbers only.\n- Do NOT add, remove, or rename fields.\n- Output ONLY valid JSON.\n- IMMEDIATELY call the Google Sheets Append Row tool using this JSON."
        }
      }
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [0, 420],
      "parameters": {
        "model": {
          "mode": "list",
          "value": "gpt-4.1-mini"
        }
      }
    },
    {
      "name": "Append row",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4,
      "position": [420, 460],
      "parameters": {
        "operation": "append",
        "documentId": "REPLACE_WITH_GOOGLE_SHEET_ID",
        "sheetName": "Internal CapEx Proposal Evaluation Register"
      }
    },
    {
      "name": "Send Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [420, 260],
      "parameters": {
        "sendTo": "={{ $('On form submission').item.json['Email id'] }}",
        "subject": "Internal CapEx Proposal – Committee Decision",
        "message": "={{ 'Dear ' + $('On form submission').item.json['Proposal Owner'] + ',<br><br>Your CapEx proposal has been reviewed by the Capital Allocation Committee. Please find the decision below.<br><br>Regards,<br>Strategy & Finance Committee' }}"
      }
    }
  ],
  "connections": {
    "On form submission": { "main": [[{ "node": "Upload file" }]] },
    "Upload file": { "main": [[{ "node": "Download file" }]] },
    "Download file": { "main": [[{ "node": "Extract Proposal" }]] },
    "Extract Proposal": { "main": [[{ "node": "Download Capital Allocation Framework" }]] },
    "Download Capital Allocation Framework": { "main": [[{ "node": "Extract Capital Framework" }]] },
    "Extract Capital Framework": { "main": [[{ "node": "AI Agent" }]] },
    "OpenAI Chat Model": { "ai_languageModel": [[{ "node": "AI Agent" }]] },
    "Append row": { "ai_tool": [[{ "node": "AI Agent" }]] },
    "AI Agent": { "main": [[{ "node": "Send Email" }]] }
  },
  "active": false
}
